@extends('layouts.default') @section('main')
    <script type="text/javascript" src="{{URL::asset('js/')}}/common.js"></script>
    <script type="text/javascript" src="/js/jquery.min.js"></script>
    <link rel="stylesheet" href="/css/chosen.css" />
    <script type="text/javascript" src="{{URL::asset('js/')}}/ajaxfileupload.js"></script>
    <script type="text/javascript" src="/js/chosen.jquery.min.js"></script>
    <div id="content">
        <div id="content-header">
            <div id="breadcrumb">
                <a href="{{url('home')}}" title="返回首页" class="tip-bottom"><i
                            class="icon-home"></i> 首页</a> <a href="{{url('activityapply/index')}}"
                                                             class="tip-bottom">活动管理</a> <a href="#" class="current">活动相关创客空间管理</a>
            </div>
        </div>
        <div class="container-fluid">
            <div class="row-fluid">
                <div class="span9">
                    <div class="widget-box">
                        <div class="widget-title">
						<span class="icon"> <i class="icon-align-justify"></i>
						</span>
                            <h5>活动相关创客空间管理</h5>
                        </div>
                        <div class="widget-content nopadding">
                            <form action="{{url('activity/activity-maker')}}" method="post" class="form-horizontal" id="adForm">
                                <div class="control-group">
                                    <label class="control-label">主办创客空间 :</label>
                                    <div class="controls">
                                        <select  name="oMaker" class="span11" >
                                            <option value="">请选择</option>
                                            @foreach($makers as $v)<option value="{{$v->id}}" @if($v->id==$oMaker) selected @endif >{{$v->name}}</option>@endforeach
                                        </select>
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label">协办空间(多选) :</label>
                                    <div class="controls">
                                        <select data-placeholder="协办空间(多选) :" class="chzn-select" name="aMakers[]" multiple style="width:600px;" tabindex="4" id="dl_chose2">
                                        @foreach($makers as $v)
                                                <option value="{{$v->id}}" @if(in_array($v->id,$aMakerIds)) selected @endif>{{$v->name}}</option>
                                            @endforeach
                                        </select>
                                    </div>
                                </div>
                                <div class="form-actions">
                                    <input type="hidden"  name="aid" value="{{$aid}}"  />
                                    <input type="hidden" name="_token" value="{{ csrf_token() }}">
                                    <button type="button" id="doSave" class="btn btn-success">编辑</button>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script>
        $(document).ready(function(){
            //初始化
            $(".chzn-select").chosen();

        });
        $("#doSave").click(function(){
            ajaxRequest($('#adForm').serializeArray(),$('#adForm').attr('action'),function(data){
                if(data.status){
                    alert(data.message);
                    window.location.href = data.forwardUrl;
                }else{
                    alert(data.message);
                }
            });
        });
    </script>
@stop
